package com.qiuguo.rtsp.config;

import com.qiuguo.rtsp.service.StreamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class LastInitializer implements SmartInitializingSingleton {

    @Resource
    StreamService streamService;

    @Override
    public void afterSingletonsInstantiated() {
        log.info("所有单例Bean已实例化，执行最后操作");
        // 执行最后的初始化逻辑
        streamService.startStreaming();
    }
}